<?php

namespace App\Models\Admin;

use App\Models\Model;

class AdminPower extends Model
{
    protected $table = 'admin_power';
    protected $primaryKey = 'power_id';

    //fillable 属性指定哪些属性可以被集体赋值;Guarded则相反
    protected $guarded = [];

    public function roles()
    {
        return $this->belongsToMany('App\Models\Admin\AdminRole','admin_power_role','power_id', 'role_id')
            ->using('App\Models\Admin\AdminPowerRole');
    }

    public function routes()
    {
        return $this->hasMany('App\Models\Admin\AdminPowerRoute', 'power_id', 'power_id');
    }

}
